package com.ls.fw.hadoop.client.bean;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;

public class Filter implements PathFilter {

	// private int size = 0;
	private int page = 1;
	private int pageSize = 20;
	private String str;
	protected int offSet = 0;
	protected int current_offeset = 0;

	public Filter(int page, int pageSize, String str) {
		super();
		this.page = page;
		this.pageSize = pageSize;
		this.str = str;
		this.offSet = (PageBean.countOffset(this.pageSize, this.page));
	}

	@Override
	public boolean accept(Path path) {
		/*
		 * System.out.println("path:"+path.toString());
		 * System.out.println("current_offeset:"+current_offeset);
		 * System.out.println("size:"+size);
		 */if (str == null || path.getName().indexOf(str) > -1) {
			/*
			 * if(size>=pageSize){ return false; } if(current_offeset>=offSet){
			 * size++; return true; } current_offeset++; return false;
			 */

			return true;
		} else {
			return false;
		}
	}
}